import Koa from 'koa'
import router from './routes/index'

// 实例化koa
const app: Koa = new Koa()

app.use(async (ctx: Koa.DefaultContext, next: Koa.Next) => {
  ctx.body = 'Hello World'
  next()
})

// 启动路由
app.use(router.routes())
app.use(router.allowedMethods())
// 监听端口
app.listen(3001, () => {
  console.log('server is running at port 3001')
})